<?php
/**
 * 文章管理控制器
 * @version 0.0.1
 * @author laiwenbang <375500819@qq.com>
 */
 namespace Admin\Controller;
 
 class ArticleController extends AuthController{
 	
	private $model;
	
	public function _initialize(){
		parent::_initialize();
		$this->model = D('Article');
	}
	
	/**
	 * 文章列表首页显示文章列表内容
	 */
	public function index(){
		//统计所有文章的数量
		$count = $this->model->count();
		//显示每页显示的条数
		$page = new \Think\Page($count,10);
		//分布查询
		$list = $this->model->order('post_time desc')->limit($page->firstRow.','.$page->listRows)->select();
		
		//分配数据
		$this->assign('list',$list);		
		//分配分页
		$this->assign('page',$page->show());
		
		$this->display();
		
	}
	
 }
